package com.ncu.cloundeoffice.exception;


import com.ncu.cloundeoffice.pojo.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLException;

@RestControllerAdvice
public class GlobalException {


    //处理sql异常
    @ExceptionHandler(SQLException.class)
    public ResponseResult sqlException(SQLException e){
        return ResponseResult.error("数据库异常,操作失败!");
    }
/*
    @ExceptionHandler(NullPointerException.class)
    public ResponseResult nullException(NullPointerException e){
        return ResponseResult.error("傻逼，连空指针异常都会出现!");
    }*/
}
